﻿<div class="row" style="margin-bottom: 20px;">
    <div class="col-xs-2 text-right" ng-class="{'col-xs-offset-2': user.level == 4}" ng-if="user.level == 4" ng-controller="modal_ctrl">
        <button type="button" class="btn btn-primary" ng-click="open('add')">
            新增
        </button>
    </div>
    <div class="col-xs-2 col-xs-offset-1" ng-if="user.level == 2">
        <div class="input-group">
            <span class="input-group-addon">市级</span>
            <select class="form-control" ng-model="city.code" ng-options="unit.code as unit.name for unit in city.data" ng-change="city_change()">
                <option value="">所有市</option>
            </select>
        </div>
    </div>
    <div class="col-xs-2" ng-class="{'col-xs-offset-2': user.level== 3}" ng-if="user.level < 4">
        <div class="input-group">
            <span class="input-group-addon">县级</span>
            <select class="form-control" ng-model="county.code" ng-options="unit.code as unit.name for unit in county.data">
                <option value="">所有县</option>
            </select>
        </div>
    </div>
    <div class="col-xs-2" ng-if="user.level == 4">
        <div class="input-group">
            <span class="input-group-addon">状态</span>
            <select class="form-control" ng-model="county.state.code" ng-options="state.code as state.name for state in county.state.data">
            </select>
        </div>
    </div>
    <div class="col-xs-2" ng-if="user.level == 3">
        <div class="input-group">
            <span class="input-group-addon">状态</span>
            <select class="form-control" ng-model="city.state.code" ng-options="state.code as state.name for state in city.state.data">
            </select>
        </div>
    </div>
    <div class="col-xs-3">
        <div class="input-group">
            <span class="input-group-addon">水利站</span>
            <input type="text" ng-model="conservancy_station" class="form-control" typeahead-on-select="station_selecting($item)"
                 typeahead-loading="loadingLocations" typeahead="_this for _this in get_stations($viewValue)"/>
            <i ng-show="loadingLocations" class="input-group-addon glyphicon glyphicon-refresh"></i>
            <div ng-show="no_results" class="input-group-addon">
                <i class="glyphicon glyphicon-remove"></i> 没有找到
            </div>
        </div>
    </div>
    <div class="col-xs-2">
        <button type="button" class="btn btn-primary" ng-click="search.from_svr()">
            搜索
        </button>
    </div>
</div>
<div class="row">
    <div class="col-xs-12">
        <table class="table table-striped table-bordered table-hover">
            <thead>
            <tr role="row">
                <th ng-if="user.level > 2" style="{{search.result.length > 0 ? 'width:87px': 'width:inherit'}}">

                </th>
                <th style="width: 59px;">
                    状态
                </th>
                <th style="width: 59px;">
                    市级
                </th>
                <th style="width: 59px;">
                    县级
                </th>
                <th style="min-width: 95px;">
                    水利站
                </th>
                <th>
                    验收报告
                </th>
                <th>
                    申报资料
                </th>
                <th>
                    验收卡
                </th>
                <th style="width: 95px;">
                    上报日期
                </th>
                <th>
                    备注
                </th>
            </tr>
            </thead>
            <tbody>
            <tr ng-repeat="_this in search.result">
                <td ng-if="user.level > 2">
                    <div class="btn-group btn-group-xs">
                        <button type="button" class="btn btn-primary" ng-controller="modal_ctrl" ng-if="show('modify',_this)" ng-click="open('modify')">改</button>
                        <button type="button" class="btn btn-success" ng-if="show('send',_this)" ng-click="operate('send',_this)">报</button>
                        <button type="button" class="btn btn-primary" ng-if="show('untread',_this)" ng-click="operate('untread',_this)">退</button>
                        <button type="button" class="btn btn-success" ng-if="show('remove',_this)" ng-click="operate('remove',_this)">删</button>
                        <button type="button" class="btn btn-primary" ng-if="show('record',_this)" ng-click="operate('record',_this)">备</button>
                    </div>
                </td>
                <td>{{state_name(_this.D02)}}</td>
                <td>{{_this.DD3}}</td>
                <td>{{_this.DD4}}</td>
                <td>{{_this.DD2}}</td>
                <td>
                    <a ng-click="download(_this.D04,_this.D07)">{{_this.D04}}</a>
                    <i class="glyphicon glyphicon-eye-open" style="margin-left: 5px; cursor: pointer;" 
                        title="预览" ng-click="preview(_this.D01, 'acept_report')"></i>
                </td>
                <td>
                    <a ng-click="download(_this.D05,_this.D08)">{{_this.D05}}</a>
                    <i class="glyphicon glyphicon-eye-open" style="margin-left: 5px; cursor: pointer;" 
                        title="预览" ng-click="preview(_this.D01, 'acept_data')"></i>
                </td>
                <td>
                    <a ng-click="download(_this.D06,_this.D09)">{{_this.D06}}</a>
                    <i class="glyphicon glyphicon-eye-open" style="margin-left: 5px; cursor: pointer;" 
                        title="预览" ng-click="preview(_this.D01, 'acept_card')"></i>
                </td>
                <td>{{_this.D03}}</td>
                <td>{{_this.D10}}</td>
            </tr>
            </tbody>
        </table>
    </div>
</div>